/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ex01;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author 20060074
 */
public class DBUtils {
    
    public static Connection openAcessConection(String dbName) throws SQLException, ClassNotFoundException {
        
            Connection con = null;
            
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            
            String connStr = "jdbc:odbc:DRIVER={Microsoft access Driver (*.mdb)}; DBQ=" + dbName ;            
            con = DriverManager.getConnection(connStr);
            
            return con;
        
    }

}
